package cn.fuck;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;

public class testUnicode {
    public static void main(String[] args) {
//        String s = new String("\\ud83d\\ude00");
//
//        System.out.println(s.indexOf(99));
        String s = "奌䵷";
        System.out.println(Arrays.toString(
                s.getBytes(StandardCharsets.UTF_16)));
        byte[] u16 = s.getBytes(StandardCharsets.UTF_16);

        System.out.println(new String(u16, 0,
                4, StandardCharsets.UTF_16));
        System.out.println(new String(u16, 4,
                2, StandardCharsets.UTF_16));

        System.out.println(Arrays.toString(
                s.getBytes(StandardCharsets.UTF_8)));
        byte[] u8 = s.getBytes(StandardCharsets.UTF_8);
        System.out.println(new String(u8, 0,
                3, StandardCharsets.UTF_8));
        System.out.println(new String(u8, 3,
                3, StandardCharsets.UTF_8));
    }
}
